package com.example.demobk.service;

import com.example.demobk.entity.Userinfo;
import com.example.demobk.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    public int reg(Userinfo userinfo){

        return userMapper.reg(userinfo);
    }

    public  Userinfo getUserByName(String username){
        return userMapper.getUserByName(username);
    }
    public Userinfo getUserById(Integer id){
        return userMapper.getUserById(id);
    }
    public int del( Integer id){
        return  userMapper.del(id);
    }

    public int dels( List<Integer> ids){
        return  userMapper.dels(ids);
    }
    public List<Userinfo> getListByPage( String username,
                                         String address,
                                         String email,
                                         Integer limit,
                                         Integer offset){
        return  userMapper.getListByPage(username,address,email,limit,offset);
    }
    public  int getListByPageCount(String username,
                                   String address,
                                   String email){
        return userMapper.getListByPageCount(username,address,email);
    }
     public int update(Userinfo userinfo) {
        return userMapper.update(userinfo);
    }
    public List<Userinfo> getAll(){
        return userMapper.getAll();
    }
    public  int add(Userinfo userinfo){
        return userMapper.adds(userinfo);
    }
    public  Userinfo getUserByLoginName(String loginname){
        return  userMapper.getUserByLoginName(loginname);
    }

    public  Userinfo getUserByUid(Integer uid){
        return  userMapper.getUserByUid(uid);
    }

}
